const http = require('http');
const path = require('path');

const readStaticFile = require('./readFileStatic');
http.createServer(async (req, res) => {
    let urlString = req.url;
    let filePathName = path.join(__dirname, '/public', urlString);
    let { data, mimeType } = await readStaticFile(filePathName);
    res.write(data);
    res.end();
}).listen(8888, () => {
    console.log('localhost:8888');
});